﻿using UnityEngine;
using System.Collections;

namespace Room
{
    public class RCAIGuardDeath : RCAIGuardBase
    {
        GameObject obj;
        protected override void OnEnter()
        {
            if (obj == null)
            {
                obj = controller.Spawn(RoomUnionFight.DIE);
                obj.transform.localPosition = new Vector3(0, 2, 0);
                obj.SetActive(true);
            }
            else
            {
                obj.SetActive(true);
            }

            controller.owner.SetInView(false);
            controller.ShowHp(false);
        }

        protected override void OnEnter(object param)
        {
            controller.owner.SetInView(false);
            controller.ShowHp(false);
        }

        protected override void OnTick()
        {
        }

        protected override void OnLeave()
        {
            if(obj!=null)
            {
                controller.Unspawn(obj);
                obj = null;
            }
            controller.owner.SetInView(true);
            controller.ShowHp(true);
        }
    }
}